// javamaps
// Copyright (c) 2010 Lup Gratian
package Rendering.Utils;
import Core.*;

// DOAR PENTRU TESTE!
public class MockProjection implements IProjection {
    int levels;

    public MockProjection(IMapProvider provider) {
        levels = provider.ZoomLevels();
    }

    public Point FromCoordinates(Coordinates coord, int zoomLevel) {
        double scale = 1.0 / (levels - zoomLevel);
        return new Point(coord.Longitude() * scale,
                         coord.Latitude() * scale);
    }

    public Coordinates ToCoordinates(Point point, int zoomLevel) {
        double scale = levels - zoomLevel;
        return new Coordinates(point.Y() * scale, point.X() * scale);
    }

    public Region2D FromRegion(Region region, int zoomLevel) {
        double scale = 1.0 / (levels - zoomLevel);
        return new Region2D(region.TopLeft().Longitude() * scale,
                            region.TopLeft().Latitude() * scale,
                            (region.BottomRight().Longitude() - region.TopLeft().Longitude()) * scale,
                            (region.BottomRight().Latitude() - region.TopLeft().Latitude()) * scale);
    }

    public Region FromRegion2D(Region2D region, int zoomLevel) {
        double scale = levels - zoomLevel;
        return new Region(region.Top() * scale, region.Left() * scale,
                          region.Bottom() * scale, region.Right() * scale);
    }
}